<?php
function getBgImageColor($bgType,$value){
    if('image' == $bgType) return 'background-image: url('.$value.');background-repeat: no-repeat';
    else return 'background-color: '.$value;
}

function getCouponHtml($padding_right,$coupon_link,$bg_image_color,$denomination,$denomination_color,$using_the_quota,$using_the_quota_color,$click_the_text,$click_the_text_color){
    return "
    <td style='$padding_right'>
    <a class='coupon' style='$bg_image_color;text-decoration: none;display: block;' $coupon_link>
            <div style='width: 290px;height: 95px;'>
                <div style='padding-top: 15px;'>
                    <table style='margin: 0 auto;text-align: center;'>
                        <tr>
                            <td><p class='denomination' style='color: $denomination_color;padding-right: 20px;'>$denomination</p></td>
                            <td><p class='using_the_quota' style='color: $using_the_quota_color;padding-bottom: 10px;'>USD&nbsp;$using_the_quota</p></td>
                        </tr>
                    </table>
                </div>
            </div>
            <div style='width: 290px;height: 30px;'>
                <p class='click-font' style='color: $click_the_text_color;'>
                    <span>$click_the_text</span>
                </p>
            </div>
        </a>
    </td>
    ";
}

?>
<div class="module dshop-um-wl-yhq-4 module-thirdparty" style='margin-bottom:<? echo $bottom_margin; ?>px; background-color:<? myEcho('bottom_color','#555555')?>;'>
    <table>
        <tr>
            <?php

            for($i=0;$i< 4;$i++){
                $padding_right = '';
                if($i != 3) $padding_right = 'padding-right: 13.5px;';

                $bg_image_color = getParam('bg_image_color_'.$i,'#2981CB');
                $bg_type = getParam('bg_type_'.$i,'color');

                echo getCouponHtml($padding_right,
                    getHref('coupon_link_'.$i),
                    getBgImageColor($bg_type,$bg_image_color),
                    getParam('denomination_'.$i,'$2.00'),
                    getParam('denomination_color_'.$i,'white'),
                    getParam('using_the_quota_'.$i,'$100'),
                    getParam('using_the_quota_color_'.$i,'white'),
                    getParam('click_the_text_'.$i,'RECEIVE IT'),
                    getParam('click_the_text_color_'.$i,'white'));
            }

            ?>
        </tr>
    </table>
</div>
